#include "index_factory.h"
#include "hnswlib/hnswlib.h"
#include <vector>
class HNSWLibIndex{
public:
    HNSWLibIndex(int dim,int num_data,IndexFactory::MetricType metric,int M=16,int ef_construction=200);
    void insert_vectors(const std::vector<float>& data,uint64_t label);
    std::pair<std::vector<long>,std::vector<float>> search_vectors(const std::vector<float>&query,int k,int ef_search=50);
    //保存
    void saveIndex(const std::string& file_path);
    //加载
    void loadIndex(const std::string& file_path);
private:
    int dim;
    hnswlib::SpaceInterface<float>* space;
    hnswlib::HierarchicalNSW<float>* index;
    size_t maxElements;
};